package com.luhui.commons.net;

import java.util.HashMap;
import java.util.Map;

/**
 * Created with LXD
 *
 * @author:Luhui
 * @qq:729913162
 * @Date:2018-08-22
 * @Time:15:15
 */
public class Request {
    private String url;
    private String paramStr;
    private String cookie;
    private String charset = "utf-8";
    private String refer;
    private String userAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; InfoPath.2; .NET4.0C; .NET4.0E)";

    private Map<String,String> attributes = new HashMap<>();

    public Request addAddtribute(String key,String value){
        attributes.put(key,value);
        return this;
    }

    public Request removeAddtribute(String key){
        attributes.remove(key);
        return this;
    }

    public Map<String,String> getAttributes(){
        return attributes;
    }

    public Request(String url) {
        this.url = url;
    }

    public String getParamStr() {
        return paramStr;
    }

    public void setParamStr(String paramStr) {
        this.paramStr = paramStr;
    }

    public Request(String url, String cookie) {
        this.url = url;
        this.cookie = cookie;
    }

    public Request(String url, String paramStr, String cookie, String charset, String refer, String userAgent) {
        this.url = url;
        this.paramStr = paramStr;
        this.cookie = cookie;
        this.charset = charset;
        this.refer = refer;
        this.userAgent = userAgent;
    }

    public Request(String url, String paramStr, String cookie) {
        this.url = url;
        this.paramStr = paramStr;
        this.cookie = cookie;
    }

    public Request(String url, String paramStr, String cookie, String charset) {
        this.url = url;
        this.paramStr = paramStr;
        this.cookie = cookie;
        this.charset = charset;
    }

    public String getUrl() {
        return url;
    }

    public Request setUrl(String url) {
        this.url = url;
        return this;
    }

    public String getCookie() {
        return cookie;
    }

    public Request setCookie(String cookie) {
        this.cookie = cookie;
        return this;
    }

    public String getCharset() {
        return charset;
    }

    public Request setCharset(String charset) {
        this.charset = charset;
        return this;
    }

    public String getRefer() {
        return refer;
    }

    public Request setRefer(String refer) {
        this.refer = refer;
        return this;
    }

    public String getUserAgent() {
        return userAgent;
    }

    public Request setUserAgent(String userAgent) {
        this.userAgent = userAgent;
        return this;
    }
}
